﻿#region Copyright and License Notice
// Copyright (C)2010-2016 - Rob Levine and other contributors
// http://configgen.codeplex.com
// 
// This file is part of ConfigGen.
// 
// ConfigGen is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// ConfigGen is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License and 
// the GNU Lesser General Public License along with ConfigGen.  
// If not, see <http://www.gnu.org/licenses/>
#endregion

using System.Collections.Generic;
using ConfigGen.ConsoleApp.Core.CommandLineOptions;
using ConfigGen.Utilities.Extensions.System;
using NUnit.Framework;

namespace ConfigGen.ConsoleApp.Core.Tests.CommandLineOptions
{
    [TestFixture]
    public class InhibitWriteTests
    {
        [Test]
        public void ShortName()
        {
            var itemUnderTest = new InhibitWrite();
            Assert.AreEqual("i", itemUnderTest.ShortName);
        }

        [Test]
        public void LongName()
        {
            var itemUnderTest = new InhibitWrite();
            Assert.AreEqual("inhibit-write", itemUnderTest.LongName);
        }

        [Test]
        public void ArgsUsage()
        {
            var itemUnderTest = new InhibitWrite();
            Assert.IsNull(itemUnderTest.ArgsUsage);
        }

        [Test]
        public void HelpText()
        {
            var itemUnderTest = new InhibitWrite();
            var argsUsage = itemUnderTest.HelpText;
            Assert.IsFalse(argsUsage.IsNullOrEmpty());
        }

        [Test]
        public void ConsumeArgumentsFromQueue()
        {
            var itemUnderTest = new InhibitWrite();
            var queue = new Queue<string>();
            queue.Enqueue("arg1");
            queue.Enqueue("arg2");
            itemUnderTest.ConsumeArgumentsFromQueue(queue);
            Assert.AreEqual(2, queue.Count, "No arg should have been consumed from queue");
        }

        [Test]
        public void ApplyOptionToSettings()
        {
            var itemUnderTest = new InhibitWrite();
          
            var settings = new ConsoleAppPreferences();
            itemUnderTest.ApplyOptionToSettings(settings);
            
            Assert.IsTrue(settings.InhibitWrite);
        }
    }
}
